import http from '../utils/http_interceptor.js';

/**
 * 登录(短信、密码)
 * @params {String} loginCode 手机号
 * @params {String} password 密码 (短信验证码，和密码二选一)
 * @params {String} code 验证码 (短信验证码，和密码二选一)
 */ 
export const login = async (params = {}, showLoading = false) => {
  return await http.post('/member/v1/client/login', params, {
	  showLoading // 不需要加载中
  });
};

/*
*  获取手机验证码
*  @params {String} mobile 手机号
*  @params {String} template 短信模板 (login register modifypwd)
*/ 
export const sendMemberCodeSMS = async (params = {}) => {
  return await http.post('/member/v1/alisms/sendMemberCodeSMS', params);
};

/**
 * 会员注册并登录
 * @params {String} loginCode 手机号
 * @params {String} password 密码
 * @params {String} code 验证码
 */ 
export const register = async (params = {}) => {
  return await http.post('/member/v1/client/register', params);
};

/**
 * 重置密码
 * @params {String} loginCode 手机号
 * @params {String} password 密码
 * @params {String} code 验证码
 */ 
export const resetPassword = async (params = {}) => {
  return await http.post('/member/v1/client/resetPassword', params);
};